var grid_demo_id = "myGrid1" ;

var dsOption= {

	fields :[
		{name : 'id' ,type:'int' },
		{name : 'icon',type: 'string'  },
		{name : 'menuName',type: 'string'  },
		{name : 'parentId',type: 'string'  },
		{name : 'parentName',type: 'string'  },
		{name : 'url',type: 'string'  }
	],
	recordType : 'object'
	//uniqueField : 'id'
}
var colsOption = [
		{id: 'chk' ,isCheckColumn : true, _checkType:'radio' ,frozen : false , filterable : false, header: "", title: "全选" , fieldName : 'id'},
		{id: 'id' , header: "id" , width :60 },
		{id: 'menuName' , header: "菜单名称" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		},
		{id: 'icon' , header: "菜单图片" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		},
		{id: 'parentId' , header: "父标识" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		},
		{id: 'parentName' , header: "父菜单名称" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		},
		{id: 'url' , header: "菜单url" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		}
		/*,
		{ id : 'channel'   , header : "操作" , width : 120,
			renderer : function(value ,record,columnObj,grid,colNo,rowNo){
				if(value == undefined){
						return "";
					}else{
						return  '&#160|&#160;<a href="'+record['url']+'"  target="_bank" title="预览">预览</a>'
					+'&#160|&#160;<a href="${base}/cms/article/article!edit.action?channelId='+record['channel']['id']+'&isLeaf=${isLeaf}&id='+record['id']+'" title="修改">修改</a>';
			
					}
				
			}
		}*/
		
 ];

var gridOption={

	//autoSaveOnNav : true ,
	//reloadAfterSave : false, 
	id : grid_demo_id,

	/* loadURL 支持函数, 该函数返回值是response对象 传递栏目id值 */
	loadURL : '/sys/menu/list',
	saveURL : '/sys/menu/doSave' ,
	replaceContainer : true,
	//remotePaging : true,

	width: "730",  //"100%", // 700,865
	height: "350",  //"100%", // 330,420

	container : 'mygrid_container',

	toolbarPosition : 'bottom', // 'top',  工具条显示的位置, 暂时不支持上下都显示.
	toolbarContent : 'nav | pagesize | reload | add del save | filter | print | state',
	pageSize :  40 ,
	pageSizeList : [40,60,80,100,200],

	dataset : dsOption ,

	columns : colsOption ,
	
	recountAfterSave : true, 
	
	defaultRecord :
	{'icon':"icon",'menuName':"liangqz",'url':"url",parentId:1913 },
	//传递参数
	parameters : { channelId:1,isLeaf:2,cc:[8,9]},
	
	//下面两个设置复选框，可以获取多条记录进行操作
	multiSelect : true,
	
	selectRowByCheck :true,

	beforeSave : function(reqParam,grid){
		//confirm("您确定要提交如下数据到 "+grid.saveURL + " 吗?\n "+GT.toJSONString(reqParam,true)+"\n");
		return confirm("您确定要提交吗?");
		
	}

};

//var mygrid = new Sigma.Grid( gridOption );

//Sigma.Utils.onLoad( function(){
//	mygrid.render();
//} );

var mygrid = new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid) );